Skip to content

Conversation

@sammyf
Copy link

@sammyf sammyf commented Jan 1, 2024

As W2L is quite old and its dependencies can not easily be ported to Python3.11 I wrote a small wrapper that starts a flask server serving W2L.

Additionally, as the application doesn't shut down after each call, the checkpoint isn't unloaded, and is only swapped if another checkpoint path is passed. This results in much better performance on subsequent calls (the first time is obviously still pretty slow if you use a different checkpoint than the default one)

The code in server.py is pretty much the same as that in inference.py. The json payload is minimal though and doesn't accept all parameters (yet?) , only those four :

{
    "checkpoint_path": "checkpoints/wav2lip.pth",
    "face": "whatever.mp4",
    "audio": "whatever.wav",
    "outfile": "result.mp4"
}

The only additional requirement is flask

sammyf added 2 commits January 1, 2024 16:49
A Flask server 'server.py' has been implemented to handle requests for lip-sync video generation. The server exposes a '/synthesize' endpoint, which consumes JSON payloads containing the paths for the face, audio and output files. It also refreshes the loaded model based on the provided 'checkpoint_path'. Additionally, Flask has been added to the requirements.txt file.
Argparse command-line structure was refactored into a class-based Args() attribute initialization. This approach converted all previous command-line arguments into class attributes, maintaining their default values, and made arguments more accessible, easier to manage and change. Arguments are now contained within the 'Args' object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant